﻿using System.Collections.Generic;
using System.Windows.Controls;
using System.Windows.Media.Media3D;

namespace Wen.UI.NavigationElements
{
	internal class PointLightViewModel : IndicatorLightViewModelBase<PointLight>
	{
		private readonly LightIndicator _positionIndicator;

		private readonly PointLightPositionViewModel _pointLightPositionViewModel;
		public PointLightPositionViewModel PositionViewModel {
			get { return _pointLightPositionViewModel; }
		}

		public PointLightViewModel(PointLight light, Viewport3D viewport3D)
			: base(light, viewport3D) {
			_pointLightPositionViewModel = new PointLightPositionViewModel(light);
			_pointLightPositionViewModel.ValueChanged += (s, e) => RefreshIndicatorsPosition();
			_positionIndicator = new LightIndicator(viewport3D, false, light.Position);
		}

		protected override IEnumerable<LightIndicator> Indicators {
			get { yield return _positionIndicator; }
		}

		protected override void RefreshIndicatorsPosition() {
			_positionIndicator.Position = Light.Position;
		}
	}
}
